<template>
  <div></div>
</template>
<script>
export default {
  name: "template",
  data() {
    return {}
  },
  components: {},
  created() {},
  mounted() {},
  watch: {},
  methods: {
    // 表格滚动加载数据
    getList() {
      // 获取表格对象
      let dom = document.querySelector(".el-table__body-wrapper")
      dom.addEventListener("scroll", v => {
        const scrollDistance = dom.scrollHeight - dom.scrollTop - dom.clientHeight
        // 判断是否到底，可以加载下一页
        if (scrollDistance <= 1) {
          // 判断是否全部加载完成
          if (this.page >= this.totalPage) {
            this.$message.warning("已经见底了 ～")
          }
          if (this.page < this.totalPage) {
            //当前页数小于总页数就请求
            this.page++ //当前页数自增
            // 加载下一页方法
            this.getNextList()
          }
        }
      })
    },
  },
}
</script>
<style scoped lang="scss"></style>
